<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Basic while loop example</title>
    <style>

    </style>
  </head>
  <body>

  <p></p>


    <script>
    const cats = ['Bill', 'Jeff', 'Pete', 'Biggles', 'Jasmin'];
    let info = 'My cats are called ';
    let para = document.querySelector('p');

    let i = 0;

    while(i < cats.length) {
      if(i === cats.length - 1) {
        info += 'and ' + cats[i] + '.';
      } else {
        info += cats[i] + ', ';
      }

      i++;
    }

    para.textContent = info;

    </script>

  </body>
</html>
